function ajax(config={}){
	const {method='get',url,success,params={},headers={}} = config;
	const xhr = new XMLHttpRequest();
	xhr.responseType="json";
	xhr.open(method,url+"?"+Object.keys(params).map(key=>key+"="+params[key]).join("&"));
	for(let key in headers){
		xhr.setRequestHeader(key,headers[key]);
	}
	
	xhr.send();
	xhr.onload = function(){
		success(xhr.response);
	}
}
ajax.get = function(url,config){
	this({
		...config,
		url,
		method:"get"
	})
}